package com.bwie.controller;

import com.bwie.common.domain.Goods;
import com.bwie.common.domain.GoodsScope;
import com.bwie.common.domain.GoodsType;
import com.bwie.common.domain.request.GoodsRequest;
import com.bwie.common.result.PageResult;
import com.bwie.common.result.Result;
import com.bwie.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @className: GoodsController
 * @Description: TODO
 * @version: v1.８.0
 * @author: 刘茂锴
 * @date: 2025/10/13 13:35
 */
@RestController
@RequestMapping("/goods")
@CrossOrigin
public class GoodsController {
    @Autowired
    private GoodsService goodsService;
    //商品列表
    @PostMapping("/list")
    public Result<PageResult<Goods>> goodsList(@RequestBody GoodsRequest goodsRequest){
        PageResult<Goods> list=goodsService.goodsList(goodsRequest);
        return Result.success(list);
    }
    //商品范围下拉框
    @GetMapping("/goodsScopeList")
    public Result goodsScopeList(){
        List<GoodsScope> goodsScopeList=goodsService.goodsScopeList();
        return Result.success(goodsScopeList);
    }
    //商品类型下拉框
    @GetMapping("/goodsTypeList")
    public Result goodsTypeList(){
        List<GoodsType> goodsTypeList=goodsService.goodsTypeList();
        return Result.success(goodsTypeList);
    }
}
